﻿using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using UnityEngine;
using System;
using System.Collections;
using Inlycat;

namespace Inlycat
{

    public class PlatformManager<T> : Singleton<PlatformManager<T>>
    {
        public enum PlatformType
        {
            Inlycat,
            UnionSDK,
            DownJoy,
            TBT,
            XiaoMi,
            UC,
            I4,
            oppo,
            kuaiyong,
            anzhi,
            baidu,
            LengJing,
            MSDK
        }

#if xiaomi
	public static PlatformType CurrentPlatform = PlatformType.XiaoMi;
#elif tbt
	public static PlatformType CurrentPlatform = PlatformType.TBT;
#elif downjoy
	public static PlatformType CurrentPlatform = PlatformType.DownJoy;
#elif unionsdk
	public static PlatformType CurrentPlatform = PlatformType.UnionSDK; 
#elif uc
	public static PlatformType CurrentPlatform = PlatformType.UC; 
#elif i4
	public static PlatformType CurrentPlatform = PlatformType.I4;
#elif oppo
	public static PlatformType CurrentPlatform = PlatformType.oppo;
#elif kuaiyong
	public static PlatformType CurrentPlatform = PlatformType.kuaiyong;
#elif anzhi
	public static PlatformType CurrentPlatform = PlatformType.anzhi;
#elif baidu
	public static PlatformType CurrentPlatform = PlatformType.baidu;
#elif lengjing
    public static PlatformType CurrentPlatform = PlatformType.LengJing;
#elif msdk
    public static PlatformType CurrentPlatform = PlatformType.MSDK;
#else
        public static PlatformType CurrentPlatform = PlatformType.Inlycat;

#endif

        public static string SplashName
        {
            get
            {
                return "Splash_" + CurrentPlatform.ToString().ToLower();
            }
        }

        public static bool IsInit = false;

        public bool IsLogined = false;

        public MessageReceiver MessageReceiverInstance;

        protected string uid = string.Empty;
        protected string token = string.Empty;
        protected string nickName = string.Empty;
        protected string channelName = string.Empty;
        protected string sid;

        public string Uid
        {
            get
            {
                return uid;
            }
            set
            {
                uid = value;
            }
        }

        public string Token
        {
            get
            {
                return token;
            }
            set
            {
                token = value;
            }
        }

        public string NickName
        {
            get
            {
                return nickName;
            }
            set
            {
                nickName = value;
            }
        }

        public string ChannelName
        {
            get
            {
                return channelName;
            }
        }

        public string Sid
        {
            get
            {
                return sid;
            }
        }

        public virtual void Init(Action onInitSuccess)
        {

        }

        public virtual void CheckUpdate(Action<bool> onCheckUpdate)
        {
            onCheckUpdate(false);
        }

        public virtual void Login(Action<string, string, string> onSucc)
        {
        }

        public virtual void Exit()
        {

        }

        public virtual void Paid(Dictionary<string, string> dic, Action onSuccess)
        {
            //MessageReceiverInstance.OnPayEnd = s =>
            //{
            //    P.Log(s);
            //    onSuccess();
            //};
        }

        public virtual void ExitSDK()
        {

        }

        public virtual void SubmitExtendData(string roleid, string rolename, string rolelevel, int zoneid, string zonename)
        {

        }

        /*
        public virtual void Paid(float money, string productInfo, string cpInfo)
        {

        }

        public virtual void Paid(string orderNo, string itemId, string itemName, int itemCount, int itemPrice, int itemOriginalPrice, string payNoticeUrl, string itemType = "", string itemDesc = "", string roleId = "", string roleName = "", string charaLevel = "", string zoneId = "", string zoneName = "", Action<string> onSuccess = null)
        {
            throw new NotImplementedException();
        }

        /// <summary>
        /// xiaomi
        /// </summary>
        /// <param name="orderId"></param>
        /// <param name="userInfo"></param>
        /// <param name="billPrice"></param>
        /// <param name="balance"></param>
        /// <param name="vipLevel"></param>
        /// <param name="charLevel"></param>
        /// <param name="guild"></param>
        /// <param name="charName"></param>
        /// <param name="charId"></param>
        /// <param name="charServer"></param>
        /// <param name="paySucc"></param>
        public virtual void Paid(string orderId, string userInfo, string billPrice, string balance, string vipLevel, string charLevel, string guild, string charName, string charId, string charServer, Action<string> paySucc)
        {
	 

        }

        /// <summary>
        /// uc
        /// </summary>
        /// <param name="money"></param>
        /// <param name="serverId"></param>
        /// <param name="roleId"></param>
        /// <param name="roleName"></param>
        /// <param name="grade"></param>
        /// <param name="customInfo"></param>
        /// <param name="notifyUrlo"></param>
        /// <param name="callBack"></param>
        public virtual void Paid(float money, int serverId, string roleId, string roleName, string grade, string customInfo, string notifyUrlo, Action callBack)
        {
	 
        }
        */
        public virtual void ReportRoleInfo()
        {

        }

        public virtual void SwitchAccount()
        {

        }

        public virtual void ReportRoleInfo(string roleId, string roleName, string charaLevel, string zoneId, string zoneName)
        {

        }



    }





}